package com.ylfstu.static_;

public class ChildGame {
    public static void main(String[] args) {
//        int count = 0;

        Child child1 = new Child("白骨精");
        child1.join();
        child1.count++;
//        count++;
        Child child2 = new Child("狐狸精");
        child2.join();
        child2.count++;
//        count++;
        Child child3 = new Child("老鼠精");
        child3.join();
//        count++;
        child3.count++;
        System.out.println("共有" + child1.count + "个小孩加入游戏..");

    }
}

class Child {
    private String name;
    //定义一个类变量(静态变量)
    public static int count = 0;

    public static void hello(String... s) {
        System.out.println("hello");
    }

    public Child(String name) {
        this.name = name;
    }

    public void join() {
        System.out.println(name + "加入了游戏..");
    }
}
